web/src/pages/[...listing].astro
824 lines · 19775 bytes
1---
2import Layout from '@layouts/Layout.astro';
3import ServiceList from '@components/things/ServiceList.astro';
4import Comments from '@components/things/Comments.svelte';
5import GitHubDetailedInfo from '@components/things/GitHubDetailedInfo.astro';
6import PrivacyPolicyDetails from '@components/things/PrivacyPolicyDetails.astro';
7import WebsiteDetailedInfo from '@components/things/WebsiteDetailedInfo.astro';
8import DockerDetailedInfo from '@components/things/DockerDetailedInfo.astro';
9import IosAppDetailedInfo from '@components/things/IosAppDetailedInfo.astro';
10import AndroidAppDetailedInfo from '@components/things/AndroidDetailedInfo.astro';
11import DiscordDetailedInfo from '@components/things/DiscordDetailedInfo.astro';
12import RedditDetailedInfo from '@components/things/RedditDetailedInfo.astro';
13import SocialShare from '@components/form/Social.astro';
14import DataActions from '@components/things/DataActions.svelte';
15import type { AwesomePrivacy, Section, Service } from '../types/Service';
16import { fetchData, slugify } from '@utils/fetch-data';
17import { fetchGitHubStats } from '@utils/fetch-repo-info';
18import { fetchTosdrPrivacy } from '@utils/fetch-privacy-policy';
19import { fetchWebsiteInfo } from '@utils/fetch-website-info';
20import { fetchDockerData } from '@utils/fetch-docker-instructions';
21import { fetchIosInfo } from '@utils/fetch-ios-info';
22import { fetchAndroidInfo } from '@utils/fetch-android-info';
23import { fetchDiscordInfo } from '@utils/fetch-discord-info';
24import { fetchRedditInfo } from '@utils/fetch-reddit-info';
25import { parseMarkdown, formatLink } from '@utils/parse-markdown';
26import { site } from '@utils/config';
27import FontAwesome from '@components/form/FontAwesome.svelte';
28import Button from '@components/form/Button.astro';
29import SaveListing from '@components/things/SaveListing.svelte';
30
31interface Props extends Service {
32 slug: string;
33 parentSection: Section;
34 categoryName: string;
35}
36
37const {
38 name,
39 description,
40 url,
41 github,
42 tosdrId,
43 discordInvite,
44 subreddit,
45 iosApp,
46 androidApp,
47 icon,
48 followWith,
49 links,
50 securityAudited,
51 openSource,
52 acceptsCrypto,
53 parentSection,
54 categoryName,
55} = Astro.props;
56
57/**
58 * Make a list of keywords, for the <meta keywords> tag
59 */
60const makeKeyWordTag = () => {
61 const keywords: string[] = [];
62 keywords.push(`open source ${parentSection.name}`);
63 keywords.push(`${parentSection.name} comparison`);
64 (parentSection.alternativeTo || []).forEach((alt: string) => {
65 keywords.push(`${alt} alternative`);
66 });
67 (parentSection.services || []).forEach((serv: Service) => {
68 keywords.push(`${serv.name} vs`);
69 });
70 keywords.push('private');
71 keywords.push('ad free');
72 keywords.push('encrypted');
73 keywords.push('open source software');
74 keywords.push('privacy respecting apps');
75 keywords.push('free tools');
76 return keywords.join(', ');
77};
78
79/**
80 * Make a page title
81 */
82const makePageTitle = () => {
83 return `${name} | ${parentSection.name} | ${categoryName} | Awesome Privacy`;
84};
85
86const makeBreadcrumbs = () => {
87 return [
88 { name: 'Home', item: '/' },
89 { name: categoryName, item: slugify(categoryName) },
90 {
91 name: parentSection.name,
92 item: `${slugify(categoryName)}/${slugify(parentSection.name)}`,
93 },
94 {
95 name: name,
96 item: `${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(name)}`,
97 },
98 ];
99};
100
101/**
102 * Make a string page intro, for the description tag
103 */
104const makeDescriptionTag = () => {
105 let description = `Analysis of ${name}, and other privacy-respecting ${parentSection.name} `;
106 if (parentSection.services) {
107 const serviceList = parentSection.services.map(
108 (serv: Service) => serv.name,
109 );
110 description += `Compare ${serviceList.join(' vs ')} more apps. `;
111 }
112 if (parentSection.alternativeTo && parentSection.alternativeTo.length > 0) {
113 description += `The best secure encrypted alternatives to ${parentSection.alternativeTo.join(', ')} in 2024. `;
114 }
115 description += 'All this, and many more free and awesome tools and software.';
116 return description;
117};
118
119// Return a list of Services, except for the currtent one
120const filterServices = () => {
121 return parentSection.services.filter(
122 (service: Service) => service.name !== name,
123 );
124};
125
126export async function getStaticPaths() {
127 const pages = await fetchData().then((data) => {
128 const results: Array<Props> = [];
129 if (!data || !data.categories) return results;
130 (data as AwesomePrivacy).categories.forEach((category) => {
131 category.sections.forEach((section) => {
132 const services = (section.services || []).map((service) => {
133 return {
134 slug: `${slugify(category.name)}/${slugify(section.name)}/${slugify(service.name)}`,
135 parentSection: section,
136 categoryName: category.name,
137 ...service,
138 };
139 });
140 results.push(...services);
141 });
142 });
143 return results;
144 });
145
146 return pages.map((props: Props) => {
147 return { params: { listing: props.slug }, props };
148 });
149}
150
151const makePaginationLinks = () => {
152 const allServices = parentSection.services || [];
153 const index = allServices.findIndex((item) => item.name === name);
154 const previousItem = index > 0 ? allServices[index - 1].name : null;
155 const nextItem =
156 index < allServices.length - 1 ? allServices[index + 1].name : null;
157 return { previous: previousItem, next: nextItem };
158};
159
160const { previous, next } = makePaginationLinks();
161
162const ignoredSites = ['github.gom', 'wikipedia.'];
163
164// Fetch detailed data about the services GitHub repo, privacy policy and website
165const githubData = github ? await fetchGitHubStats(github) : null;
166const privacyData = tosdrId ? await fetchTosdrPrivacy(tosdrId) : null;
167const iosData = iosApp ? await fetchIosInfo(iosApp) : null;
168const androidData = androidApp ? await fetchAndroidInfo(androidApp) : null;
169const discordData = discordInvite
170 ? await fetchDiscordInfo(discordInvite)
171 : null;
172const redditData = subreddit ? await fetchRedditInfo(subreddit) : null;
173const dockerData = await fetchDockerData(name);
174const websiteData =
175 url && !ignoredSites.some((ignoredSite) => url.includes(ignoredSite))
176 ? await fetchWebsiteInfo(url)
177 : null;
178
179const findPrivacyPolicyLink = () => {
180 if (!privacyData) return null;
181 // const docs = privacyData?.parameters?.documents;
182 // if (docs) {
183 // const privacyPolicy = (docs || []).find((doc) => doc.name.toLowerCase().includes('privacy policy'));
184 // if (privacyPolicy) return privacyPolicy.url;
185 // }
186 return `https://tosdr.org/en/service/${tosdrId}`;
187};
188
189const privacyPolicyLink = findPrivacyPolicyLink();
190
191const getApiEndpoint = () => {
192 return `https://api.awesome-privacy.xyz/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(name)}`;
193};
194---
195
196<Layout
197 title={makePageTitle()}
198 keywords={makeKeyWordTag()}
199 description={makeDescriptionTag()}
200 breadcrumbs={makeBreadcrumbs()}
201>
202 <main>
203 <section>
204 <div class="service-head">
205 <h2>{name}</h2>
206 <span class="url-wrap">
207 <a class="service-url" href={url}>{formatLink(url)}</a>
208 <span class="follow-with">{followWith}</span>
209 </span>
210 </div>
211 <div class="breadcrumbs">
212 <span>
213 <a href="/">Awesome Privacy</a>
214 ➔ <a href={`/${slugify(categoryName)}`}>{categoryName}</a>
215 ➔ <a href={`/${slugify(categoryName)}/${slugify(parentSection.name)}`}
216 >{parentSection.name}</a
217 >
218 ➔ <a
219 href={`/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(name)}`}
220 >{name}</a
221 >
222 </span>
223 </div>
224 <div class="save-listing">
225 <SaveListing
226 client:visible
227 categoryName={categoryName}
228 sectionName={parentSection.name}
229 serviceName={name}
230 showLabel={true}
231 />
232 </div>
233 <div class="intro">
234 <img
235 width="60"
236 height="60"
237 loading="lazy"
238 decoding="async"
239 class="service-icon"
240 alt={`${name} Icon`}
241 data-service-url={formatLink(url)}
242 src={icon || `https://icon.horse/icon/${formatLink(url)}`}
243 />
244 <div>
245 <p class="description" set:html={parseMarkdown(description)} />
246 <ul>
247 {
248 url && (
249 <li>
250 <b>Homepage:</b>
251 <a href={url}>{formatLink(url)}</a>
252 </li>
253 )
254 }
255 {
256 github && (
257 <li>
258 <b>GitHub:</b>
259 <a href={`https://github.com/${github}`}>
260 github.com/{github}
261 </a>
262 </li>
263 )
264 }
265 {
266 tosdrId && (
267 <li>
268 <b>Privacy:</b>
269 <a href={privacyPolicyLink}>
270 {formatLink(privacyPolicyLink || '')}
271 </a>
272 </li>
273 )
274 }
275 {
276 iosApp && (
277 <li>
278 <b>iOS App:</b>
279 <a href={iosApp}>{formatLink(iosApp)}</a>
280 </li>
281 )
282 }
283 {
284 androidApp && (
285 <li>
286 <b>Android App:</b>
287 <a
288 href={`https://play.google.com/store/apps/details?id=${androidApp}`}
289 >{`https://play.google.com/store/apps/details?id=${androidApp}`}</a>
290 </li>
291 )
292 }
293 {
294 discordInvite && (
295 <li>
296 <b>Discord Invite:</b>
297 <a href={`https://discord.com/invite/${discordInvite}`}>
298 {discordInvite}
299 </a>
300 </li>
301 )
302 }
303 {
304 subreddit && (
305 <li>
306 <b>Subreddit:</b>
307 <a href={`https://reddit.com/r/${subreddit}`}>
308 r/{subreddit}
309 </a>
310 </li>
311 )
312 }
313 {
314 url && (
315 <li>
316 <b>Web info:</b>
317 <a
318 href={`https://web-check.xyz/results/${formatLink(url)}`}
319 >{`web-check.xyz/results/${formatLink(url).split('/')[0]}`}</a>
320 </li>
321 )
322 }
323 {
324 links &&
325 links.length > 0 &&
326 links.map((link) => (
327 <li>
328 <b>{link.title}</b>
329 <a href={link.url}>{link.url}</a>
330 </li>
331 ))
332 }
333 </ul>
334 </div>
335 </div>
336 <div class="highlights">
337 {
338 securityAudited && (
339 <span
340 class="meta-item great"
341 title={`${name} has been security audited by an accredited auditor, with results published publicly`}
342 >
343 <FontAwesome iconName="securityAudited" /> Security Audited
344 </span>
345 )
346 }
347 {
348 acceptsCrypto && (
349 <span
350 class="meta-item great"
351 title={`${name} accepts anonymous payment methods`}
352 >
353 <FontAwesome iconName="cryptoAccepted" /> Crypto Payments Accepted
354 </span>
355 )
356 }
357 {
358 securityAudited === false && (
359 <span
360 class="meta-item warning"
361 title={`${name} has not been audited`}
362 >
363 <FontAwesome iconName="notSecurityAudited" /> No Security Audit
364 </span>
365 )
366 }
367 {
368 openSource === false && (
369 <span class="warning">
370 <FontAwesome iconName="closedSource" />
371 Not Open Source
372 </span>
373 )
374 }
375 {
376 openSource || (github && openSource !== false) ? (
377 <span class="meta-item great" title={`${name} is open source`}>
378 <FontAwesome iconName="openSource" /> Open Source
379 </span>
380 ) : null
381 }
382 </div>
383 </section>
384 {
385 privacyData && privacyData.parameters.points.length > 0 && (
386 <section>
387 <h3>{name} Privacy Policy</h3>
388 <PrivacyPolicyDetails privacyData={privacyData} />
389 </section>
390 )
391 }
392 {
393 github && githubData && (
394 <section class="github-wrap">
395 <h3>{name} Source Code</h3>
396 <GitHubDetailedInfo gitHubData={githubData} repo={github} />
397 </section>
398 )
399 }
400 {
401 websiteData && (
402 <section>
403 <h3>{name} Website</h3>
404 <WebsiteDetailedInfo url={url} websiteInfo={websiteData} />
405 </section>
406 )
407 }
408 {
409 androidData && !androidData.error && (
410 <section>
411 <h3>{name} Android App</h3>
412 <AndroidAppDetailedInfo androidData={androidData} />
413 </section>
414 )
415 }
416 {
417 iosData &&
418 typeof iosData === 'object' &&
419 Object.keys(iosData).length > 0 && (
420 <section>
421 <h3>{name} iOS App</h3>
422 <IosAppDetailedInfo url={url} iosData={iosData} />
423 </section>
424 )
425 }
426 {
427 dockerData && dockerData.found && (
428 <section>
429 <h3>{name} Docker</h3>
430 <DockerDetailedInfo docker={dockerData} />
431 </section>
432 )
433 }
434 {
435 (discordData || redditData) && (
436 <section>
437 <h3>{name} Socials</h3>
438 <div class="social-wrap">
439 {discordData && <DiscordDetailedInfo discordData={discordData} />}
440 {redditData && <RedditDetailedInfo redditData={redditData} />}
441 </div>
442 </section>
443 )
444 }
445
446 <section>
447 <h3>{name} Reviews</h3>
448 <Comments client:visible />
449 </section>
450
451 <section>
452 <h3>More {parentSection.name}</h3>
453 <ServiceList
454 services={filterServices()}
455 subHeading={true}
456 noGitHubMetrics={true}
457 buttonLink={`/${slugify(categoryName)}/${slugify(parentSection.name)}`}
458 categoryName={categoryName}
459 sectionName={parentSection.name}
460 />
461 </section>
462 <section>
463 <h3>About the Data: {name}</h3>
464 <DataActions
465 client:load
466 categoryName={categoryName}
467 sectionName={parentSection.name}
468 serviceName={name}
469 />
470 <h4>API</h4>
471 <p>
472 You can access {name}'s data programmatically via our API. Simply make a <code
473 >GET</code
474 > request to:
475 </p>
476 <pre><a href={getApiEndpoint()}><code>{getApiEndpoint()}</code></a></pre>
477 <p>
478 The REST API is free, no-auth and CORS-enabled. To learn more, view the <a
479 href="/api">Swagger Docs</a
480 > or read the <a href="/about#api">API Usage Guide</a>.
481 </p>
482
483 <h4>About the Data</h4>
484 <p>
485 Beyond the user-submitted YAML you see above, we also augment each
486 listing with additional data dynamically fetched from several sources.
487 To learn more about where the rest of data included in this page comes
488 from, and how it is computed, see the <a href="/about#our-data"
489 >About the Data</a
490 > section of our About page.
491 </p>
492 </section>
493
494 <section>
495 <h3>Share {name}</h3>
496 <p>
497 Help your friends compare {parentSection.name}, and pick
498 privacy-respecting software and services.<br />
499 Share {name} and Awesome Privacy with your network!
500 <div>
501 <SocialShare
502 url={`${site}/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(name)} `}
503 title={`Checkout ${name}! \n`}
504 description={`Compare #${name} and other privacy-respecting ${parentSection.name} at ` +
505 `Awesome-Privacy.xyz, the free and open source list of private software alternatives. ` +
506 `#privacy #opensource #awesomeprivacy by @Lissy_Sykes`}
507 />
508 </div>
509 </p>
510 </section>
511
512 <div class="pagination-navigation">
513 {
514 previous ? (
515 <Button
516 url={`/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(previous)}`}
517 >
518 <span>← Previous</span>
519 <p>{previous}</p>
520 </Button>
521 ) : (
522 <p class="nothing" />
523 )
524 }
525 <a
526 href={`/${slugify(categoryName)}/${slugify(parentSection.name)}`}
527 class="go-to-category"
528 >
529 View {parentSection.name} ({(parentSection.services || []).length})
530 </a>
531 {
532 next && (
533 <Button
534 url={`/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(next)}`}
535 >
536 <span>Next →</span>
537 <p>{next}</p>
538 </Button>
539 )
540 }
541 </div>
542 </main>
543</Layout>
544
545<style lang="scss">
546 main {
547 margin: 2rem auto;
548 padding: 1rem;
549 width: 1200px;
550 max-width: calc(100% - 5rem);
551 position: relative;
552 @media (max-width: 768px) {
553 max-width: 95%;
554 padding: 0.5rem;
555 margin: 0 auto;
556 }
557 }
558
559 section {
560 margin: 1rem 0 4rem 0;
561 padding: 1rem;
562 min-height: 8rem;
563 position: relative;
564 border: 2px solid var(--box-outline);
565 box-shadow: 6px 6px 0 var(--box-outline);
566 background: var(--accent-fg);
567 }
568
569 p {
570 margin: 0.25rem 0 0.5rem 0;
571 }
572
573 h3 {
574 font-size: 2rem;
575 margin: -2rem 0 1rem -2rem;
576 box-shadow: 6px 6px 0 var(--box-outline);
577 background: var(--accent);
578 color: var(--accent-fg);
579 width: fit-content;
580 padding: 0.25rem 0.5rem;
581 @media (max-width: 768px) {
582 margin: -2rem auto 2rem auto;
583 }
584 }
585
586 .service-head {
587 h2 {
588 font-size: 3rem;
589 margin: 0;
590 @media (max-width: 768px) {
591 text-align: center;
592 }
593 }
594 .url-wrap {
595 display: flex;
596 align-items: center;
597 gap: 0.5rem;
598 a {
599 font-size: 1.2rem;
600 }
601 .follow-with {
602 font-style: italic;
603 opacity: 0.6;
604 }
605 @media (max-width: 768px) {
606 flex-direction: column;
607 }
608 }
609 }
610
611 .breadcrumbs {
612 opacity: 0.5;
613 font-size: 0.8rem;
614 position: absolute;
615 right: 1rem;
616 top: 1rem;
617 a {
618 color: var(--foreground);
619 transition: all 0.15s ease-in-out;
620
621 &:hover {
622 color: var(--accent);
623 }
624 }
625 @media (max-width: 768px) {
626 display: none;
627 }
628 }
629
630 .save-listing {
631 position: absolute;
632 top: 3rem;
633 right: 1rem;
634 }
635
636 h4 {
637 font-size: 1.4rem;
638 margin-bottom: 0;
639 }
640
641 .intro {
642 font-size: 1.2rem;
643 font-style: italic;
644 opacity: 0.9;
645 display: flex;
646 gap: 0.5rem;
647 @media (max-width: 768px) {
648 flex-direction: column;
649 }
650 .service-icon {
651 border-radius: var(--curve-md);
652 margin-top: 1rem;
653 @media (max-width: 768px) {
654 margin: 1rem auto 0 auto;
655 }
656 }
657 ul {
658 padding-left: 1rem;
659 list-style: circle;
660 font-style: normal;
661 font-size: 1rem;
662 margin-top: 0;
663 b {
664 font-size: 1rem;
665 font-weight: 400;
666 min-width: 100px;
667 display: inline-block;
668 @media (max-width: 768px) {
669 width: auto;
670 display: block;
671 }
672 }
673 }
674 }
675
676 .pagination-navigation {
677 display: flex;
678 justify-content: space-between;
679 align-items: center;
680 padding: 1rem 0;
681 :global(.button) {
682 min-width: 120px;
683 width: fit-content;
684 padding: 0.25rem 1rem;
685 text-align: right;
686 &:first-child {
687 text-align: left;
688 }
689 p {
690 margin: 0;
691 font-weight: normal;
692 font-size: 1rem;
693 }
694 span {
695 font-size: 0.8rem;
696 }
697 }
698 .nothing {
699 width: 120px;
700 }
701 .go-to-category {
702 color: var(--foreground);
703 font-size: 0.8rem;
704 opacity: 0.5;
705 @media (max-width: 768px) {
706 display: none;
707 }
708 }
709 }
710
711 .further-info,
712 .notable-mentions,
713 .word-of-warning {
714 h3 {
715 font-size: 1.4rem;
716 margin: 1rem 0;
717 }
718 :global(p) {
719 font-size: 0.9rem;
720 opacity: 0.7;
721 :global(strong) {
722 font-weight: 500;
723 }
724 :global(a) {
725 color: var(--foreground);
726 transition: all 0.15s ease-in-out;
727 &:hover {
728 color: var(--accent);
729 }
730 }
731 }
732 :global(strong) {
733 font-weight: 500;
734 }
735 :global(h4) {
736 font-size: 1.2rem;
737 margin: 0.5rem 0 0 0;
738 }
739 :global(ul) {
740 list-style: circle;
741 padding-left: 1rem;
742 font-size: 0.9rem;
743 opacity: 0.7;
744 li {
745 margin-bottom: 0.25rem;
746 :global(p) {
747 display: inline;
748 }
749 }
750 }
751 }
752
753 pre {
754 a {
755 text-decoration: none;
756 color: var(--foreground);
757 code {
758 background: #acabb782;
759 padding: 0.2rem 0.4rem;
760 border-radius: var(--curve-sm);
761 font-family: Courier New;
762 font-size: 0.9rem;
763 @media (max-width: 768px) {
764 white-space: break-spaces;
765 }
766 }
767 }
768 }
769
770 .social-wrap {
771 display: flex;
772 gap: 1rem;
773 flex-wrap: wrap;
774 justify-content: space-between;
775 }
776
777 .highlights {
778 display: flex;
779 gap: 1rem;
780 flex-wrap: wrap;
781 align-items: center;
782 justify-content: end;
783
784 .meta-item,
785 .warning {
786 display: flex;
787 align-items: center;
788 // justify-content: center;
789 gap: 0.25rem;
790 opacity: 0.6;
791 font-size: 0.9rem;
792 padding: 0.5rem 0;
793 :global(svg) {
794 color: var(--foreground);
795 width: 1.2rem;
796 height: 1.2rem;
797 }
798 a {
799 text-decoration: none;
800 color: var(--foreground);
801 display: flex;
802 gap: 0.25rem;
803 &:hover {
804 color: var(--accent-3);
805 :global(svg) {
806 color: var(--accent-3);
807 }
808 }
809 }
810 }
811 .warning {
812 color: var(--danger);
813 :global(svg) {
814 color: var(--danger);
815 }
816 }
817 .great {
818 color: #007930; // var(--success);
819 :global(svg) {
820 color: #007930; // var(--success);
821 }
822 }
823 }
824</style>